<?php

  
      
   /**
   * 竞赛试题列表类类
   *创建新的竞赛试题列表 
   *@author kinet 380511703@qq.cn
   *@time 2010-4-18 to 2010-5-16    
   *@version 1.2
   */
  require_once('db_obj.class.php') ; 
  class contest_problem_list extends db_obj{
         private $vdb;
         public function __construct( $db ){         
                 parent::__construct( $db , 'contest_problem_list' ); 
                 $this->vdb=$db;
                 $this->add('contest_no' , '');                  
                 $this->add('problem_no' , '');
                   
    }/**
     * 载入
     * 
     * @param 竞赛号
     * @param 题号
     */
    public function load($contest_no,$problem_no){
            $sql="select * 
                  from contest_problem_list  
                  where 
                  contest_no=".$contest_no." 
                  and problem_no=".$problem_no;
                  $res = $this->vdb->query( $sql ) ;  
                  if(PEAR::isError($res)) {
                        return false;
                 }
                $rows = $res->fetchRow( MDB2_FETCHMODE_ASSOC );
                if ( $rows ){
                     $this->set('contest_no',$rows['contest_no']);
                     $this->set('problem_no',$rows['problem_no']); 
                     return true;                    
               }
               else
                      return false;
        
    }  /**
       * 删除
       *   
       * @param 竞赛号
       * @param 题号
       */
      public function del($contest_no,$problem_no){
           $sql="delete from contest_problem_list  ".
                            "where ".
                            "problem_no=".$problem_no." and ".
                            "contest_no=".$contest_no;                  
                       $res = $this->vdb->query( $sql ) ; 
                       if(PEAR::isError($res)) { 
                        return false ;
                      }
            return true;
          
      }  
    } 
   
?>
